import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import DefineOptions from 'unplugin-vue-define-options/vite';
import { resolve } from "path";
const pathResolve = (dir: string): string => {
  return resolve(__dirname, ".", dir);
};
export default defineConfig(({ mode }) => {
  return {
    plugins: [vue(), DefineOptions()],
    base: mode === "production" ? "" : "",
    resolve: {
      alias: {
        "@": pathResolve("src"),
      },
    },
    server: {
      // 是否开启 https
      https: false,
      // 端口号
      port: 3006,
      host: "0.0.0.0",
      proxy: {
        "/dev-api": {
          target: "http://172.35.253.26/unifiedPortal",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/dev-api/, ""),
        },
      },
    },
  };
});
